package com.ruoyi.crm.sale.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.crm.sale.mapper.CrmCustomerContactsMapper;
import com.ruoyi.crm.sale.domain.CrmCustomerContacts;
import com.ruoyi.crm.sale.service.ICrmCustomerContactsService;

/**
 * 联系人管理Service业务层处理
 * 
 * @author ruoyi
 * @date 2021-09-14
 */
@Service
public class CrmCustomerContactsServiceImpl implements ICrmCustomerContactsService 
{
    @Autowired
    private CrmCustomerContactsMapper crmCustomerContactsMapper;

    /**
     * 查询联系人管理
     * 
     * @param id 联系人管理ID
     * @return 联系人管理
     */
    @Override
    public CrmCustomerContacts selectCrmCustomerContactsById(Long id)
    {
        return crmCustomerContactsMapper.selectCrmCustomerContactsById(id);
    }

    /**
     * 查询联系人管理列表
     * 
     * @param crmCustomerContacts 联系人管理
     * @return 联系人管理
     */
    @Override
    public List<CrmCustomerContacts> selectCrmCustomerContactsList(CrmCustomerContacts crmCustomerContacts)
    {
        return crmCustomerContactsMapper.selectCrmCustomerContactsList(crmCustomerContacts);
    }

    /**
     * 新增联系人管理
     * 
     * @param crmCustomerContacts 联系人管理
     * @return 结果
     */
    @Override
    public int insertCrmCustomerContacts(CrmCustomerContacts crmCustomerContacts)
    {
    	crmCustomerContacts.setCreateTime(DateUtils.getNowDate());
    	crmCustomerContacts.setUpdateTime(DateUtils.getNowDate());
    	crmCustomerContacts.setCreateBy(String.valueOf(SecurityUtils.getLoginUser().getUser().getUserId()));
        return crmCustomerContactsMapper.insertCrmCustomerContacts(crmCustomerContacts);
    }

    /**
     * 修改联系人管理
     * 
     * @param crmCustomerContacts 联系人管理
     * @return 结果
     */
    @Override
    public int updateCrmCustomerContacts(CrmCustomerContacts crmCustomerContacts)
    {
    	crmCustomerContacts.setUpdateTime(DateUtils.getNowDate());
    	crmCustomerContacts.setUpdateBy(String.valueOf(SecurityUtils.getLoginUser().getUser().getUserId()));
        return crmCustomerContactsMapper.updateCrmCustomerContacts(crmCustomerContacts);
    }

    /**
     * 批量删除联系人管理
     * 
     * @param ids 需要删除的联系人管理ID
     * @return 结果
     */
    @Override
    public int deleteCrmCustomerContactsByIds(Long[] ids)
    {
        return crmCustomerContactsMapper.deleteCrmCustomerContactsByIds(ids);
    }

    /**
     * 删除联系人管理信息
     * 
     * @param id 联系人管理ID
     * @return 结果
     */
    @Override
    public int deleteCrmCustomerContactsById(Long id)
    {
        return crmCustomerContactsMapper.deleteCrmCustomerContactsById(id);
    }
}
